package org.yray.sip.log;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;

@Slf4j
public abstract class AbstractLog {

    public static void log(String trace,String apiCode,String info,Object... params)
    {
        MDC.put("trace", trace);
        MDC.put("apiCode", apiCode);
        log.info(info,params);
    }
    public static void logD(String trace,String apiCode,String info,Object... params)
    {
        MDC.put("trace", trace);
        MDC.put("apiCode", apiCode);
        log.debug(info,params);
    }

    public void log(String trace,String info,Object... params)
    {
        MDC.put("trace", trace);
        MDC.put("apiCode", this.getClass().getName());
        log.info(info,params);
    }
    public void logE(String trace,String info,Object... params)
    {
        MDC.put("trace", trace);
        MDC.put("apiCode", this.getClass().getName());
        log.error(info,params);
    }
}
